package demo3;

/**
 * @author ：陈奕安（3048279304@qq.com）
 * @date ：Created in 2025/5/7 0:02
 * @description：
 * @modified By：
 * @version:
 */
public class Computer {
    public void open()
    {
        System.out.println("开机");
    }
    public void close()
    {
        System.out.println("关机");
    }
    public void useUseDevice(USB usb)
    {
        usb.openDevice();
        if (usb instanceof Mouse){
            Mouse mouse=(Mouse) usb;
            mouse.click();
        }else {
            KeyBoard keyBoard=(KeyBoard) usb;
            keyBoard.click();
        }
        usb.closeDevice();
    }
}